package c.a.a.z.b;

import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import c.a.a.b0.e;
import c.a.a.b0.f;
import c.a.a.b0.k.n;
import c.a.a.e0.g;
import c.a.a.f0.c;
import c.a.a.l;
import c.a.a.z.c.a;
import c.a.a.z.c.a.b;
import c.a.a.z.c.o;
import com.pgl.sys.ces.out.ISdkLite;
import java.util.ArrayList;
import java.util.List;

/* compiled from: ContentGroup */
public class d implements e, m, b, f {
    public Paint a;
    public RectF b;
    public final Matrix c;
    public final Path d;
    public final RectF e;
    public final String f;
    public final boolean g;
    public final List<c> h;
    public final l i;
    public List<m> j;
    public o k;

    public d(l lVar, c.a.a.b0.l.b bVar, n nVar) {
        c.a.a.b0.j.l lVar2;
        String str = nVar.a;
        boolean z = nVar.c;
        List list = nVar.b;
        ArrayList arrayList = new ArrayList(list.size());
        for (int i = 0; i < list.size(); i++) {
            c a = ((c.a.a.b0.k.b) list.get(i)).a(lVar, bVar);
            if (a != null) {
                arrayList.add(a);
            }
        }
        List list2 = nVar.b;
        for (int i2 = 0; i2 < list2.size(); i2++) {
            c.a.a.b0.k.b bVar2 = (c.a.a.b0.k.b) list2.get(i2);
            if (bVar2 instanceof c.a.a.b0.j.l) {
                lVar2 = (c.a.a.b0.j.l) bVar2;
                break;
            }
        }
        lVar2 = null;
        this(lVar, bVar, str, z, arrayList, lVar2);
    }

    public String a() {
        return this.f;
    }

    public void b(RectF rectF, Matrix matrix, boolean z) {
        this.c.set(matrix);
        o oVar = this.k;
        if (oVar != null) {
            this.c.preConcat(oVar.e());
        }
        this.e.set(0.0f, 0.0f, 0.0f, 0.0f);
        for (int size = this.h.size() - 1; size >= 0; size--) {
            c cVar = (c) this.h.get(size);
            if (cVar instanceof e) {
                ((e) cVar).b(this.e, this.c, z);
                rectF.union(this.e);
            }
        }
    }

    public void c() {
        this.i.invalidateSelf();
    }

    public void d(List<c> list, List<c> list2) {
        ArrayList arrayList = new ArrayList(this.h.size() + list.size());
        arrayList.addAll(list);
        for (int size = this.h.size() - 1; size >= 0; size--) {
            c cVar = (c) this.h.get(size);
            cVar.d(arrayList, this.h.subList(0, size));
            arrayList.add(cVar);
        }
    }

    public List<m> e() {
        if (this.j == null) {
            this.j = new ArrayList();
            for (int i = 0; i < this.h.size(); i++) {
                c cVar = (c) this.h.get(i);
                if (cVar instanceof m) {
                    this.j.add((m) cVar);
                }
            }
        }
        return this.j;
    }

    public void f(e eVar, int i, List<e> list, e eVar2) {
        if (eVar.e(this.f, i)) {
            if (!"__container".equals(this.f)) {
                eVar2 = eVar2.a(this.f);
                if (eVar.c(this.f, i)) {
                    list.add(eVar2.g(this));
                }
            }
            if (eVar.f(this.f, i)) {
                int d = eVar.d(this.f, i) + i;
                for (i = 0; i < this.h.size(); i++) {
                    c cVar = (c) this.h.get(i);
                    if (cVar instanceof f) {
                        ((f) cVar).f(eVar, d, list, eVar2);
                    }
                }
            }
        }
    }

    public void g(Canvas canvas, Matrix matrix, int i) {
        if (!this.g) {
            int i2;
            this.c.set(matrix);
            o oVar = this.k;
            if (oVar != null) {
                this.c.preConcat(oVar.e());
                a aVar = this.k.j;
                if (aVar == null) {
                    i2 = 100;
                } else {
                    i2 = ((Integer) aVar.e()).intValue();
                }
                i = (int) ((((((float) i2) / 100.0f) * ((float) i)) / 255.0f) * 255.0f);
            }
            Object obj = null;
            if (this.i.r) {
                Object obj2;
                int i3 = 0;
                for (i2 = 0; i2 < this.h.size(); i2++) {
                    if (this.h.get(i2) instanceof e) {
                        i3++;
                        if (i3 >= 2) {
                            obj2 = 1;
                            break;
                        }
                    }
                }
                obj2 = null;
                if (!(obj2 == null || i == ISdkLite.REGION_UNSET)) {
                    obj = 1;
                }
            }
            if (obj != null) {
                this.b.set(0.0f, 0.0f, 0.0f, 0.0f);
                b(this.b, this.c, true);
                this.a.setAlpha(i);
                g.f(canvas, this.b, this.a, 31);
            }
            if (obj != null) {
                i = ISdkLite.REGION_UNSET;
            }
            for (i2 = this.h.size() - 1; i2 >= 0; i2--) {
                Object obj3 = this.h.get(i2);
                if (obj3 instanceof e) {
                    ((e) obj3).g(canvas, this.c, i);
                }
            }
            if (obj != null) {
                canvas.restore();
            }
        }
    }

    public Path h() {
        this.c.reset();
        o oVar = this.k;
        if (oVar != null) {
            this.c.set(oVar.e());
        }
        this.d.reset();
        if (this.g) {
            return this.d;
        }
        for (int size = this.h.size() - 1; size >= 0; size--) {
            c cVar = (c) this.h.get(size);
            if (cVar instanceof m) {
                this.d.addPath(((m) cVar).h(), this.c);
            }
        }
        return this.d;
    }

    public <T> void i(T t, c<T> cVar) {
        o oVar = this.k;
        if (oVar != null) {
            oVar.c(t, cVar);
        }
    }

    public d(l lVar, c.a.a.b0.l.b bVar, String str, boolean z, List<c> list, c.a.a.b0.j.l lVar2) {
        this.a = new c.a.a.z.a();
        this.b = new RectF();
        this.c = new Matrix();
        this.d = new Path();
        this.e = new RectF();
        this.f = str;
        this.i = lVar;
        this.g = z;
        this.h = list;
        if (lVar2 != null) {
            o oVar = new o(lVar2);
            this.k = oVar;
            oVar.a(bVar);
            this.k.b(this);
        }
        ArrayList arrayList = new ArrayList();
        int size = list.size();
        while (true) {
            size--;
            if (size < 0) {
                break;
            }
            c cVar = (c) list.get(size);
            if (cVar instanceof j) {
                arrayList.add((j) cVar);
            }
        }
        size = arrayList.size();
        while (true) {
            size--;
            if (size >= 0) {
                ((j) arrayList.get(size)).e(list.listIterator(list.size()));
            } else {
                return;
            }
        }
    }
}
